package org.creativor.rayson.server;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.io.ByteArrayOutputStream;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.DataOutput;
import java.io.DataOutputStream;
import java.io.PipedInputStream;
import org.creativor.rayson.api.RpcProtocol;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

/**
 * The class <code>ServiceDescriptionImplTest</code> contains tests for the
 * class <code>{@link ServiceDescriptionImpl}</code>.
 * <p>
 * Copyright Creativor Studio (c) 2011
 * 
 * @generatedBy CodePro at 11-5-7 上午2:45
 * @author Nick Zhang
 * @version $Revision: 1.0 $
 */
public class ServiceDescriptionImplTest
{
	/**
	 * Launch the test.
	 * 
	 * @param args
	 *            the command line arguments
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:45
	 */
	public static void main(String[] args)
	{
		new org.junit.runner.JUnitCore().run(ServiceDescriptionImplTest.class);
	}
	
	/**
	 * Perform pre-test initialization.
	 * 
	 * @throws Exception
	 *             if the initialization fails for some reason
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:45
	 */
	@Before
	public void setUp() throws Exception
	{
		// TODO: add additional set up code here
	}
	
	/**
	 * Perform post-test clean-up.
	 * 
	 * @throws Exception
	 *             if the clean-up fails for some reason
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:45
	 */
	@After
	public void tearDown() throws Exception
	{
		// TODO: add additional tear down code here
	}
	
	/**
	 * Run the String getDescription() method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:45
	 */
	@Test
	public void testGetDescription_1() throws Exception
	{
		ServiceDescriptionImpl fixture = new ServiceDescriptionImpl("", "", new Class[] {});
		
		String result = fixture.getDescription();
		
		// TODO: add additional test code here
		assertEquals("", result);
	}
	
	/**
	 * Run the String getName() method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:45
	 */
	@Test
	public void testGetName_1() throws Exception
	{
		ServiceDescriptionImpl fixture = new ServiceDescriptionImpl("", "", new Class[] {});
		
		String result = fixture.getName();
		
		// TODO: add additional test code here
		assertEquals("", result);
	}
	
	/**
	 * Run the String[] getProxys() method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:45
	 */
	@Test
	public void testGetProxys_1() throws Exception
	{
		ServiceDescriptionImpl fixture = new ServiceDescriptionImpl("", "", new Class[] {});
		
		String[] result = fixture.getProtocols();
		
		// TODO: add additional test code here
		assertNotNull(result);
		assertEquals(0, result.length);
	}
	
	/**
	 * Run the void read(DataInput) method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:45
	 */
	@Test(expected = java.io.IOException.class)
	public void testRead_1() throws Exception
	{
		ServiceDescriptionImpl fixture = new ServiceDescriptionImpl("", "", new Class[] {});
		DataInput in = new DataInputStream(new PipedInputStream());
		
		fixture.read(in);
		
		// TODO: add additional test code here
	}
	
	/**
	 * Run the void read(DataInput) method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:45
	 */
	@Test(expected = java.io.IOException.class)
	public void testRead_2() throws Exception
	{
		ServiceDescriptionImpl fixture = new ServiceDescriptionImpl("", "", new Class[] {});
		DataInput in = new DataInputStream(new PipedInputStream());
		
		fixture.read(in);
		
		// TODO: add additional test code here
	}
	
	/**
	 * Run the void read(DataInput) method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:45
	 */
	@Test(expected = java.io.IOException.class)
	public void testRead_3() throws Exception
	{
		ServiceDescriptionImpl fixture = new ServiceDescriptionImpl("", "", new Class[] {});
		DataInput in = new DataInputStream(new PipedInputStream());
		
		fixture.read(in);
		
		// TODO: add additional test code here
	}
	
	/**
	 * Run the void read(DataInput) method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:45
	 */
	@Test(expected = java.io.IOException.class)
	public void testRead_4() throws Exception
	{
		ServiceDescriptionImpl fixture = new ServiceDescriptionImpl("", "", new Class[] {});
		DataInput in = new DataInputStream(new PipedInputStream());
		
		fixture.read(in);
		
		// TODO: add additional test code here
	}
	
	/**
	 * Run the ServiceDescriptionImpl(String,String,Class<? extends RpcProxy>[])
	 * constructor test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:45
	 */
	@Test
	public void testServiceDescriptionImpl_1() throws Exception
	{
		String serviceName = "";
		String description = "";
		Class<? extends RpcProtocol>[] protocols = new Class[] { RpcProtocol.class };
		
		ServiceDescriptionImpl result =
				new ServiceDescriptionImpl(serviceName, description, protocols);
		
		// TODO: add additional test code here
		assertNotNull(result);
	}
	
	/**
	 * Run the ServiceDescriptionImpl(String,String,Class<? extends RpcProxy>[])
	 * constructor test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:45
	 */
	@Test
	public void testServiceDescriptionImpl_2() throws Exception
	{
		String serviceName = "";
		String description = "";
		Class<? extends RpcProtocol>[] protocols = new Class[] {};
		
		ServiceDescriptionImpl result =
				new ServiceDescriptionImpl(serviceName, description, protocols);
		
		// TODO: add additional test code here
		assertNotNull(result);
		assertEquals("{name: , description: , protocols: ]}", result.toString());
		assertEquals("", result.getName());
		assertEquals("", result.getDescription());
	}
	
	/**
	 * Run the String toString() method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:45
	 */
	@Test
	public void testToString_1() throws Exception
	{
		ServiceDescriptionImpl fixture = new ServiceDescriptionImpl("", "", new Class[] {});
		
		String result = fixture.toString();
		
		// TODO: add additional test code here
		assertEquals("{name: , description: , protocols: ]}", result);
	}
	
	/**
	 * Run the String toString() method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:45
	 */
	@Test
	public void testToString_2() throws Exception
	{
		ServiceDescriptionImpl fixture = new ServiceDescriptionImpl("", "", new Class[] {});
		
		String result = fixture.toString();
		
		// TODO: add additional test code here
		assertEquals("{name: , description: , protocols: ]}", result);
	}
	
	/**
	 * Run the void write(DataOutput) method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:45
	 */
	@Test
	public void testWrite_1() throws Exception
	{
		ServiceDescriptionImpl fixture = new ServiceDescriptionImpl("", "", new Class[] {});
		DataOutput out = new DataOutputStream(new ByteArrayOutputStream());
		
		fixture.write(out);
		
		// TODO: add additional test code here
	}
	
	/**
	 * Run the void write(DataOutput) method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:45
	 */
	@Test
	public void testWrite_2() throws Exception
	{
		ServiceDescriptionImpl fixture = new ServiceDescriptionImpl("", "", new Class[] {});
		DataOutput out = new DataOutputStream(new ByteArrayOutputStream());
		
		fixture.write(out);
		
		// TODO: add additional test code here
	}
	
	/**
	 * Run the void write(DataOutput) method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:45
	 */
	@Test
	public void testWrite_3() throws Exception
	{
		ServiceDescriptionImpl fixture = new ServiceDescriptionImpl("", "", new Class[] {});
		DataOutput out = new DataOutputStream(new ByteArrayOutputStream());
		
		fixture.write(out);
		
		// TODO: add additional test code here
	}
	
	/**
	 * Run the void write(DataOutput) method test.
	 * 
	 * @throws Exception
	 * 
	 * @generatedBy CodePro at 11-5-7 上午2:45
	 */
	@Test
	public void testWrite_4() throws Exception
	{
		ServiceDescriptionImpl fixture = new ServiceDescriptionImpl("", "", new Class[] {});
		DataOutput out = new DataOutputStream(new ByteArrayOutputStream());
		
		fixture.write(out);
		
		// TODO: add additional test code here
	}
}
